<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<input type="text"  id="1" value="" />
		<select id="set">
			<option value="add">+</option>
			<option value="less">-</option>
			<option value="ride">×</option>
			<option value="exce">÷</option>
		</select>
		<input type="text" name="" id="2" value="" />
		<p id="p"></p>
		<button type="button" onclick="button1()">计算</button>
	</body>
	<script type="text/javascript">
		
		function button1(){
			var num1 = parseFloat(document.getElementById('1').value)
			var num2 = parseFloat(document.getElementById('2').value)
			var num3=0;
			var set=document.getElementById('set').value
			switch (set){
				case 'add':
					num3=num1+num2;
					break;
				case 'less':
					num3=num1-num2;
					break;
				case 'ride':
					num3=num1*num2;
					break;
				case 'exce':
					num3=num1/num2;
					break;
				default:
					break;
			}
			document.getElementById('p').innerHTML=num3
			
		}
		
		
	</script>
</html>
